package 力扣日常刷题.木22二月.第04天210;

/**
 * @author 帅小伙
 * @date 2022/2/10
 * @description
 */
public class Demo33和为s的两个数字 {

    public int[] twoSum(int[] nums, int target) {
        int r = nums.length-1;
        for (int i = 0; i < nums.length; i++) {
            while(nums[i] + nums[r] >= target){
                if(nums[i] + nums[r] == target) return new int[]{nums[i],nums[r]};
                else r --;
            }
        }
        return new int[0];

    }

}
